﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.Threading;
using AutoMapper;
using Sautom.Queries;
using Sautom.Queries.ReportOptimizedDto;
using Sautom.Services.Dto;
using Sautom.WcfServer.Interfaces;
using Sautom.WcfServer.TransportDto;

namespace Sautom.WcfServer.Services
{
    //todo T4
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
    sealed public partial class ReportService : IReportService
    {
        #region Properties
        public IReportFinder ReportFinder { get; set; }
        #endregion

        #region Constructors
        public ReportService(IReportFinder reportFinder)
        {
            ReportFinder = reportFinder;
        }

        #endregion

        #region Implementation of IReportService

        public List<OrderReportDtoReport> OrderReport(OrderReportDtoReport standard)
        {
            var input = Mapper.Map<OrderReportDto>(standard);
            return Mapper.Map<List<OrderReportDtoReport>>(ReportFinder.OrderReport(input));
        }

        #endregion
    }
}
